//ڷ http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600%28v=vs.85%29.aspx
//չڷ http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543%28v=vs.85%29.aspx


interface IWindow{
Properties:
   (read,write) Left;//
   (read,write) Top; 
   (read,write) Width; 
   (read,write) Height; 
   (read,write) Style; //ڷ
   (read,write) ExStyle;//չ
   (read,write) Caption;//ڱ
Methods:
	IWindow GetChild(class_name,index);//ȡΪclass_nameĵindex
	//flag=1 ͬGetParent
	//flag=2 ȡھ
	// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633502%28v=vs.85%29.aspx
	IWindow GetAncestor(flag = 1);
	void SetParent(IWindow parent);
	void SendMsg(msg,wp,lp);
	//ϸflag http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548%28v=vs.85%29.aspx 
	void Show(flag);
	void Move(x,y,w,h,redraw = false);
	boolean IsVisible();
	boolean IsMinimized();
	boolean IsMaximized();
	//vista+
	//mode = 0ʱl t r bӦ///ױ߾
	//mode = 1ʱӦ(l,t)(r,b)Ϊ/µľ
	void CreateGlass( l, r, t , b, mode = 0);
	//color ͸ɫ
	void SetWindowTransparency(opacity,color);
	int MsgBox(caption,prompt,type);
	String InputBox(caption="",prompt="",defval="",num_only = false);
	//mode
	// 0 ļ 1 ļ 2 Ŀ¼
	// Ŀ¼ʱtitle 
	String FileDialog(mode = 0,title="Open",filetype="All Files|*.*",defext="*");
	IGdiBitmap PrintWindow(client_only = false);
}

interface IPrivateFontCollection{
Properties:
	(readonly) FamilyCount;
Methods:
	int AddFont(path);
	IGdiFont GetFont(name,size,style);
}

//ʵ
interface IHttpRequest{
Methods:
    void AddHeader(str);
    void AddPostData(name,value);
    String Run(url);
    int RunAsync(url);//첽url󣬷cookieֵɺon_http_run_done(cookie,string);
}

interface WSHUtils{
Methods:
	IWindow GetWND(class_name);
	IWindow CreateWND(window_id);
	IWindow ReleaseCapture();
	boolean IsAeroEnabled();
	IGdiBitmap DecodeBase64Image(str);
	String GetClipboardText();
	void SetClipboardText(str);
	void PlaySound(path,flag);
	HCURSOR LoadCursorX(path);
	HCURSOR SetCursorX(handle);
	void ReleaseCursorX(handle);
	boolean IsVistaOrGreater();
	//http://msdn.microsoft.com/en-us/library/windows/desktop/dd318700%28v=vs.85%29.aspx
	String LCMapString(str,lcid,flag);
	//type_str:
	//"GET"
	//"POST"
	IHttpRequest CreateHttpRequest(type_str);
	VBArray GetWindowsVersion();
}

interface IThemeManager {
Methods:
	//Vista+
	void DrawThemeTextEx(IGdiGraphics, text, color, x, y, w, h, iGlowSize = 5 , format = 0);
}

interface IGdiUtils {
Methods:
	//ֵ0ɹ
	int AddFontResEx( path,fl=0);
	//flAddFontResExеֵͬ
	int RemoveFontResEx( path,fl=0);
	IPrivateFontCollection CreatePrivateFontCollection();
	IGdiBitmap CloneGraphics(IGdiGraphics,x,y,w,h);
}

interface IGdiGraphics{
Methods:
  void FillPie(x,y,w,h,start_angle,sweep_angle,color);
  void DrawPie(x,y,w,h,start_angle,sweep_angle,color);
}

interface IFbPlaylistManager {
Methods:
   string PlaylistGetAutoName(playlistIndex);//ԶȡбƣбĿ
   //б
   //FLAGs:
   //FLAG_ADD = 0x00000001
   //FLAG_REMOVE = 0x00000002
   //FLAG_REORDER  = 0x00000004
   //FLAG_REPLACE  = 0x00000008
   //FLAG_RENAME = 0x00000010
   //FLAG_REMOVE_PLAYLIST = 0x00000020
   void PlaylistLock(playlistIndex,flag);
   //עĲбindexĺʹøĺnew_indexunlock
   void PlaylistUnlock(playlistIndex);
   void ProcessLocationsAsync(urls);//ɺon_process_locations_done(metadbs)
}

//improve
interface IFbTitleFormat {
Methods:
    //foobar2000 v1.3.0 ϣעfromfile
    String Eval(force = false,fromfile = false);
    String EvalWithMetadb(IFbMetadbHandle,fromfile = false);
    void Dispose();
}

interface IFbMetadbHandle {
Methods:
    //foobar2000 v1.3.0 ϣע
    IFbFileInfo GetFileInfo(fromfile = false);
    void UpdateFileInfo(IFbFileInfo,force = false);
}

interface IFbUtils {
Methods:
    void ShowPreferences(guid_str="");
    boolean LoadPlaylistV2(path);
    boolean SavePlaylistV2(path,handles,overwrite = false);//overwrite=trueʱԭļΪ"ԭбļ.bak"
}

interface IWSHUtils {
Methods:
    //ҳGUID̨
    void PrintPreferencePageGUID();
    //pattern: -ʾ-ģ巽ʽзָe.g.   "c:\\%album%.jpg\ncover.jpg";
    IGdiBitmap GetAlbumArtV3(metadb, pattern , art_id = 0, need_stub = true, load_embed = true , use_fallback = true);
}

//ʾ
//var WS_CAPTION = 0x00C00000;
//ȡDUIfbڡע⣬ͬʱ򿪶DUIfoobar2000Ҫô˷ȡ
//var fb_wnd = utils.GetWND("{97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}"); //DUI
//fb_wnd.Left += 1;//λƶ1
//fb_wnd.Style &= ~WS_CAPTION;//ȥWS_CAPTION
//fb_wnd.Style |= WS_CAPTION;//ڼWS_CAPTION
//fb_wnd.Caption = "ڱ";//ôڱ(ı)
//fb.trace(fb_wnd.Caption);//ȡı

//var wsh_wnd = fb_wnd.GetChild("uie_wsh_panel_mod_plus_class",2);//ȡ2wsh plusĴڶ
//var fb_wnd2 = wsh_wnd.GetAncestor(2);//ȡ
//var my_pfc = gdi.CreatePrivateFontCollection();//һ˽弯
//my_pfc.AddFont("c:\\Ȫ.ttf");//һ
//my_pfc.AddFont("c:\\Ů.ttf");//һ
//my_pfc.AddFont("c:\\ϸ.ttf");//...һ
//fb.trace(my_pfc.FamilyCount);//ڼ3
//var font1 = my_pfc.GetFont("ŮW5(P)",38,0);//ڼȡһIGdiFont󣬴С38
//var img = gdi.CreateImage(200,200);//һ200*200СͼƬʼ͸
//var g = img.GetGraphics();//ȡͼƬһIGdiGraphicsӿڵĶ
//g.FillSolidRect(1,2,199,198,0xef000000);//Ե(1,2)ΪϽǣһ199198ĺɫ
//g.DrawString("ʾ",font1,0xEFFFFFFF,0,0,200,200);//font1֣ע:flaghelper.txtStringFormat()ãɫʹRGB(r,g,b)
//img.ReleaseGraphics(g);//ǵͷIGdiGraphicsӿڵĶ;
//on_paint(gr){} пgr.DrawImage(img,....);

fb.IsMediaLibraryEnabled();
fb.GetAllItemsInMediaLibrary();
fb.QueryMulti(handles,query_string);
fb.GetMainMenuCommandStatus(command);

GetMainMenuCommandStatusflag
flag_disabled = 1,
flag_checked = 2,
flag_radiochecked = 4,

window.CreateToolTip("Segoe UI", 32, 1)
IFbMetadbHandleList.CalcTotalDuration() handle list method. returns the total in seconds.
IFbMetadbHandleList.CalcTotalSize() handle list method. returns the total in bytes.
utils.FormatDuration(seconds). returns a string like "3wk 2d 1:30:21"
utils.FormatFileSize(bytes). returns a string like "7.9 GB"

fb.GetQueryItems(source_handlelist, query)
fb.GetQueryItems(handle_list, query); (IFbMetadbHandleList)
/*
example1: var fav_playlist_items = fb.GetQueryItems(plman.GetPlaylistItems(plman.ActivePlaylist), "rating IS 5");
example2: var fav_library_items = fb.GetQueryItems(fb.GetLibraryItems(), "rating IS 5");
results are unsorted

NOTE: use try/catch to handle invalid queries. An empty handle list will be returned if the query is valid but there are no results.
*/

plman.ClearPlaylist(playlistIndex)
plman.AddLocations(playlistIndex, paths[, select])
fb.ShowLibrarySearchUI(query)

fb.GetLibraryRelativePath(handle)

/*example
var items = fb.GetLibraryItems();
items.OrderByPath();
var current = "";
var folders = [];
for (var i = 0; i < items.Count; i++) {    
    var temp = items.Item(i).Path.replace(fb.GetLibraryRelativePath(items.Item(i)), "");
    if (temp != current) {
        current = temp;
        folders.push(current);
    }
}
fb.ShowPopupMessage(folders.join("\n"));
*/

IFbMetadbHandleList.UpdateFileInfoSimple(field1, value1 [, filed2, value2 [,...] ] [, multivalue_fields]);

IFbMetadbHandleList.UpdateFileInfoArray([field1, value1,field2, value2....]);

/*example
var toRemoveArray=Array();
var toKeepArray=["album","artist","composer","date","genre","title","tracknumber"];
var track_FileInfo = plist_items.Item(0).GetFileInfo();
for (var i = 0; i <= track_FileInfo.MetaCount; i++) {
       if(!arrayContains(toKeepArray , track_FileInfo.MetaName(i))) {
           toRemoveArray[toRemoveArray.length]=track_FileInfo.MetaName(i);
           toRemoveArray[toRemoveArray.length]="";
       }
}
plist_items.UpdateFileInfoArray(toRemoveArray);
*/


ESLyric

ñ
windows.NotifyOthers("_eslyric_set_background_image_",gdi.CreateImage(44,22));
windows.NotifyOthers("_eslyric_set_background_color_",RGB(25,50,100));

_eslyric_set_text_color_normal_
_eslyric_set_text_color_highlight_
_eslyric_set_background_color_
_eslyric_set_text_font_
_eslyric_set_text_titleformat_fallback_
_eslyric_set_text_fallback_
_eslyric_set_background_image_

ɫĺĲ RGB(xx,xx,xx)
ľ IGdiFont
ͼƬIGdiBitmap